package com.ztrue.framework.core.event;

import java.util.Collection;
import java.util.List;

/**
 * 表示一个领域事件存储
 *
 * @author zhangw
 * @date 2016/11/2 16:20
 * @version: 1.0
 */
public interface IEventStore {
    /**
     * 从领域事件存储中查询指定聚合根事件范围
     *
     * @param aggregateRootId
     * @param aggregateRootTypeName
     * @param minVersion
     * @param maxVersion
     * @return
     */
    List<IDomainEvent> queryAggregateEvents(String aggregateRootId, String aggregateRootTypeName, long minVersion, long maxVersion) throws ClassNotFoundException;

    /**
     * 从领域事件存储中查询指定聚合根
     *
     * @param aggregateRootId
     * @param aggregateRootTypeName
     * @return
     */
    List<IDomainEvent> queryAggregateEvents(String aggregateRootId, String aggregateRootTypeName) throws ClassNotFoundException;

    /**
     * 添加领域事件到存储中
     *
     * @param domainEventStream
     */
    void append(DomainEventStream domainEventStream);
}
